package com.shuijianbaozi.mediaplayer;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * Created by bodhixu on 2016/9/26.
 * 四大控件和application的创建方式相同,都需要在清单文件中注册,换句话说清单文件是四大控件的注册表
 */
public class UpdateReceiver extends BroadcastReceiver{//		--广播接收器 为了接收播放进度

    private IUpdateListener updateListener;

    public UpdateReceiver(IUpdateListener updateListener) {// 构造函数注入监听器
        this.updateListener = updateListener;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        //提取播放进度
        int progress = intent.getIntExtra(MyContstants.KEY_PLAY_PROGRESS, 0);
        updateListener.updateMediaPlayerProgress(progress);
    }

}
